package com.ljl;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author 刘家良
 * @date 2022/10/26 00:59
 * @description
 */
public class MsgHandler extends SimpleChannelInboundHandler<String> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String s) throws Exception {
        System.out.printf("收到来自[%s]的消息[%s]\r\n", ctx.channel().remoteAddress().toString(), s);
        System.out.println("服务器回复[ok!]\r\n");
        ctx.writeAndFlush("ok!");
    }

}
